home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / programm.ing / rsc2obj.lzh / README < prev    next >
Encoding:
Text File  |  1992-05-27  |  3.7 KB  |  119 lines

  1. RSC2OBJ: (No exernal Resource file)
  2. """"""""
  3.  
  4. RSC2OBJ creates a DRI compatible objekt format can link to your program.
  5.     Calling: 'rsc2obj <rsc-file>.RSC <obj-file>.O LABEL -r
  6. <rsc-file>.RSC : Resorcefile.
  7. <rsc-file>.O   : Objektfile.
  8. LABEL          : Name(Identifier) for the RESOURCE.
  9.                  Declaration in C: extern RSHDR LABEL;
  10.                  (RSHDR is defined in aes.h).
  11. -r             : [optional] Relocates the addresses in tree, this meens
  12.                  pointer to free_images, free_strings, tedinfo-structs.
  13.                  Must set if you are using the moduls in RESOURCE\ folder.
  14.  
  15.  
  16. Library functions:
  17. """"""""""""""""""
  18.  
  19. int rsrc_shdr   ( RSHDR *rsheader );
  20. int rsrc_ghdr   ( RSHDR **rsheader );
  21. int rsrc_sobject( RSHDR *rsc, int re_gtype, int re_gindex, void *gaddr );
  22. int rsrc_gobject( RSHDR *rsc, int re_gtype, int re_gindex, void **gaddr );
  23.  
  24.  
  25. rsrc_shdr (ReSoRCe_SetHeaDeR):
  26. ------------------------------
  27.  Make an 'rsrc_obfix()' to all objects of the given  Resorce (rsheader).
  28.  Install the Resource in the global-array ([5,6] = ap_ptree) like it is
  29.  done by rsrc_load and put a pointer to the resource-header in the
  30.  'global'-array[3,4] and the lenght into global[9].
  31.  
  32.   RSHDR   *rsheader   : Pointer to the ResourceHeader of the Resource.
  33.   <Returns>           : 0 - ERROR
  34.                         1 - OK
  35.  
  36.  
  37. rsrc_ghdr (ReSoRCe_GetHeaDeR):
  38. ------------------------------
  39.  Get the Resource-header from 'global'-array ([3,4] = ap_pprivat).
  40.  
  41.   RSHDR  **rsheader   : Address of pointer to get the pointer of the
  42.                         ResourceHeader.
  43.   <Returns>           : 0 - ERROR
  44.                         1 - OK
  45.  
  46.  
  47. rsrc_sobj (ReSoRCe_SetOBJect):
  48. ---------------------------------
  49.  Identical with 'rsrc_saddr()' using ResourceHeaders.
  50.  
  51.   RSHDR   *rsc        : Pointer to the ResourceHeader.
  52.   int      re_gtype   : Type of objekt. (look rsrc_saddr())
  53.   int      re_gindex  : Index of objektes
  54.   void    *gaddr      : Value.
  55.   <Returns>           : 0 - ERROR
  56.                         1 - OK
  57.  
  58.  
  59. rsrc_gobj (ReSoRCe_GetOBJect):
  60. ------------------------------
  61.  Identical with rsrc_gaddr() using ResourceHeadrs.
  62.  
  63.   RSHDR   *rsc        : Pointer to the ResourceHeader.
  64.   int      re_gtype   : Type of objekt. (look rsrc_saddr())
  65.   int      re_gindex  : Index of objektes
  66.   void   **gaddr      : Returned value.
  67.   <Returns>           : 0 - ERROR
  68.                         1 - OK
  69.  
  70.  
  71.  
  72. ===========================================================================
  73.  
  74. A pice of C:
  75. ------------
  76.  
  77.   extern RSHDR    GEM_VIEW;
  78.   :
  79.   :
  80.   rsrc_shdr (&GEM_VIEW); /* automatic rsrc_obfix() calls */
  81.   if (_app) {
  82.     rsrc_gaddr(R_TREE, GVIEWMNU, &menu);
  83.     :
  84.     :
  85.     menu_bar(menu, 1);
  86.   }
  87.  
  88. ---------------------
  89. OR
  90. ---------------------
  91.  
  92.   #define IMGICON  0   /* Formular/Dialog */
  93.   extern RSHDR  ICON_IMG;
  94.   :
  95.   :
  96.   {
  97.     OBJECT *object;
  98.     int     i;
  99.     object = *((OBJECT**)(ICON_IMG.rsh_trindex + (long)&ICON_IMG));
  100.       for (i = 0; i < ICON_IMG.rsh_nobs; i++)
  101. #if CONSTANT
  102.       {
  103.         /* For ICONS (all) use HIGH_RES! */
  104.         object[i].ob_x      =  8 * (object[i].ob_x      & 0x00FF) + ((object[i].ob_x      >> 8) & 0x00FF);
  105.         object[i].ob_y      = 16 * (object[i].ob_y      & 0x00FF) + ((object[i].ob_y      >> 8) & 0x00FF);
  106.         object[i].ob_width  =  8 * (object[i].ob_width  & 0x00FF) + ((object[i].ob_width  >> 8) & 0x00FF);
  107.         object[i].ob_height = 16 * (object[i].ob_height & 0x00FF) + ((object[i].ob_height >> 8) & 0x00FF);
  108.       }
  109. #else
  110.       rsrc_obfix(object, i);
  111. #endif
  112.   }
  113.   rsrc_gobject(&ICON_IMG, R_TREE, IMGICON, (void**) &iconTree);
  114.  
  115. ---------------------
  116. No problems for more then one Resource in your next program.
  117.  
  118.  
  119.     Dieter